//
//  Dictionary+Extension.swift
//  GoGlobalis
//
//  Created by goglobails on 2018/10/18.
//  Copyright © 2018年 Webkul. All rights reserved.
//

import Foundation

extension Dictionary {
    
    //数组转json
    func toJSONString() -> String {
        
        if (!JSONSerialization.isValidJSONObject(self)) {
            print("无法解析出JSONString")
            return ""
        }
        
        let data : Data! = try? JSONSerialization.data(withJSONObject: self, options: [])
        let json = String(data: data, encoding: String.Encoding.utf8)
        return json ?? ""
    }
}
